<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1 {
            margin: 50px;
            border: 50px solid yellowgreen;
            padding: 50px;
            width: 400px;
            height: 400px;
            background-color: pink;
        }
        #box2 {
            margin: 50px;
            border: 50px solid skyblue;
            padding: 50px;
            width: 100px;
            height: 100px;
            background-color: green;
        }
    </style>
</head>
<body>
    <div id="box1">
        <div id="box2"></div>
    </div>
    <script src="./js/jquery-1.12.3.js"></script>
    <script>
        var box2 = $("#box2")
        
        // 快捷尺寸
        // content:100
        console.log("width", "height", box2.width(), box2.height());
        // content+padding尺寸:100+50*2=200
        console.log("innerWidth", "innerHeight", box2.innerWidth(), box2.innerHeight());
        // content+padding+borde:100+50*2+50*2=300
        console.log("outerWidth", "outerHeight", box2.outerWidth(), box2.outerHeight());
        // content+padding+border+margin:100+50*2+50*2+50*2=400
        console.log("outerWidth(true)", "outerHeight(true)", box2.outerWidth(true), box2.outerHeight(true));

    </script>
</body>
</html>